package win.zxshuo.www.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import win.zxshuo.www.model.BookModel;
import win.zxshuo.www.model.BookShelfModel;

import java.util.List;

/**
 * Author:rffanlab
 * Created:2018/3/30
 */
@Repository
public interface BookShelfRepository extends JpaRepository<BookShelfModel,Long> {

    @Query(value = "select b.* from book b,bookshelf bs where bs.bookid=b.id and bs.user_id=?1;",nativeQuery = true)
    List<BookModel> getBooksByUserId(Long userid);



}
